package org.crazyit.cloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * @Author JLL
 * @Date 2018/8/10/0010 ???? 4:07
 */
@RestController
public class MyRestController {
    @Autowired
    private ApplicationContext ctx;

    @GetMapping("/prop")
    public String getName(){
        return ctx.getEnvironment().getProperty("test.user.name");
    }

    @RequestMapping(value = "/restDemo/{id}",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public String restDemo(@PathVariable(value = "id") String myid){
        String result = myid;
        return result;
    }


}
